Skip to content

Upgrade rules_go and adapt Go build rules - #15037

Open
tamird wants to merge 1 commit into
google:masterfrom
tamird:rules-go-0-62
Open

tamird wants to merge 1 commit into
google:masterfrom
tamird:rules-go-0-62

Conversation

@tamird

@tamird tamird commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

The rules_go archive override still selects 0.57 despite declaring 0.59, and retains implicit symbols removed by Bazel 9. Upgrade to 0.63 from the Bazel Central Registry while retaining the required local patches. This also satisfies the rules_go dependency of hermetic-llvm 1. Align Gazelle and platforms with rules_go and refresh their license records.

Bazel 8.5 exposes module-extension facts through a Facts object. The 0.57 SDK extension treats it as a dictionary and fails before target analysis. This upgrade includes the upstream API adaptation 2.

Use the public Go context fields and rule factory 3. The factory owns the C++ toolchain declarations needed by custom cgo rules, avoiding a load of private rules_go definitions. Nogo's aspect only analyzes Go sources; request its SDK and target mode without a C++ context, retaining race and sanitizer settings 4. Select cgo-capable target platforms for race and plugin builds while the pure flag still disables ordinary cgo.

Rebase the cgo and export patches while preserving registration of otherwise unreferenced C objects and both test compilation archives. Remove the obsolete SDK patch: go_sdk.from_file already supports the upstream patches and patch_strip API.

Newer rules_go versions install cmd/internal/cov and cmd/internal/bio archives for coverage 5. Skip cmd archives when enumerating the standard library because nogo already excludes their sources from analysis.

Assisted-by: Codex

@tamird
tamird force-pushed the rules-go-0-62 branch 3 times, most recently from 2673d51 to ad5a9c9 Compare September 30, 2026 02:54
The rules_go archive override still selects 0.57 despite declaring 0.59,
and retains implicit symbols removed by Bazel 9. Upgrade to 0.63 from
the Bazel Central Registry while retaining the required local patches.
This also satisfies the rules_go dependency of hermetic-llvm [1]. Align
Gazelle and platforms with rules_go and refresh their license records.

Bazel 8.5 exposes module-extension facts through a Facts object. The
0.57 SDK extension treats it as a dictionary and fails before target
analysis. This upgrade includes the upstream API adaptation [2].

Use the public Go context fields and rule factory [3]. The factory owns
the C++ toolchain declarations needed by custom cgo rules, avoiding a
load of private rules_go definitions. Nogo's aspect only analyzes Go
sources; request its SDK and target mode without a C++ context, retaining
race and sanitizer settings [4]. Select cgo-capable target platforms for
race and plugin builds while the pure flag still disables ordinary cgo.

Rebase the cgo and export patches while preserving registration of
otherwise unreferenced C objects and both test compilation archives.
Remove the obsolete SDK patch: go_sdk.from_file already supports the
upstream patches and patch_strip API.

Newer rules_go versions install cmd/internal/cov and cmd/internal/bio
archives for coverage [5]. Skip cmd archives when enumerating the standard
library because nogo already excludes their sources from analysis.

[1]: https://github.com/hermeticbuild/hermetic-llvm/blob/v0.8.23/MODULE.bazel
[2]: bazel-contrib/rules_go@30a6f8da4
[3]: bazel-contrib/rules_go@cb2845953
[4]: bazel-contrib/rules_go@903722985
[5]: bazel-contrib/rules_go@56929daa4

Assisted-by: Codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants